<template>
  <div>
    <template v-for="(item, idx) in list">
      <el-menu-single-item
        :key="idx"
        :item="item"
        :parentPath="parentPath"
        v-if="
          (!item.children || item.children.length === 0) &&
          !item.redirect &&
          item.meta.isShow
        "
      ></el-menu-single-item>

      <el-submenu
        :key="idx"
        :index="item.meta.index"
        :route="{ path: item.path }"
        v-if="
          item.children &&
          item.children.length !== 0 &&
          !item.redirect &&
          item.meta.isShow
        "
      >
        <template slot="title">
          <i :class="item.meta.icon"></i>
          <span>{{ $t(item.meta.title) }}</span>
        </template>
        <el-submenu-item
          :list="item.children"
          :parentPath="item.path"
        ></el-submenu-item>
      </el-submenu>
    </template>
  </div>
</template>
<script>
import ElMenuSingleItem from "./ElMenuSingleItem.vue";
export default {
  components: { ElMenuSingleItem },
  name: "ElSubmenuItem",
  props: ["list", "parentPath"],
};
</script>
<style>
</style>